//
//  KeyHeader.h
//  prlife
//
//  Created by monkey on 17/2/23.
//  Copyright © 2017年 prlife. All rights reserved.
//

#import "UIColor+expanded.h"
#import "UIView+Common.h"
#ifndef KeyHeader_h
#define KeyHeader_h

//当前window
#define kKeyWindow [UIApplication sharedApplication].keyWindow

//是否是模拟器
#define IsSimulator 1

//初次加载 标识符
#define KLaunchKey @"firstLaunch"

/**屏幕高度*/
#define KVIEW_H [UIScreen mainScreen].bounds.size.height

/**屏幕宽度*/
#define KVIEW_W [UIScreen mainScreen].bounds.size.width

//
#define KScreen_Center CGPointMake(KVIEW_W/2.0, KVIEW_H/2.0 - 44)

#define kScaleFrom_iPhone5_Desgin(_X_) (_X_ * (KVIEW_W/320))

//宽高比
#define KSCALE_W [UIScreen mainScreen].bounds.size.width/1920.0
#define KSCALE_H [UIScreen mainScreen].bounds.size.height/1080.0

#define KTABBAR_H 140
#define kLoopViewHeight 500
#define kOffSet 15

// 当前版本
#define KSystemVersion  [[[UIDevice currentDevice] systemVersion] floatValue]

#define KIMAGE_TOOL(imageUrl) [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",K_IMAGE_API,imageUrl]]
#define ImageNamed(name)     [UIImage imageNamed:name]

// 是否空对象
#define KIS_NULL_CLASS(OBJECT) [OBJECT isKindOfClass:[NSNull class]]

#define KWeakSelf(type)  __weak typeof(type) weak##type = type;

#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
#define KColor (arc4random()% 155 + 55)
#define KRGB RGBA(KColor,KColor,KColor,1.0f)

//背景颜色
#define KDefaultBackColor RGB(0, 190, 220)

#define K_BACKGROUD_color RGB(237, 241, 244)


#define K_DefaultImage [UIImage imageNamed:@"444"]
#define KBackImage [UIImage imageNamed:@"icon_pic_break"]

/********************* Color *********************/

#define K_ColorGreen RGB(26,174,102)
#define K_ColorGary RGB(242,242,242)
#define K_ColorBlack RGB(124,124,124)
#define K_ColorSection RGB(245,245,245)

#define kColorOrange @"26,174,102"
#define kColorGreen @"26,174,102"
#define kColorGary  @"242,242,242"
#define kColorBlack @"124,124,124"
#define KColorSection @"245,245,245"

#define kColorRed [UIColor colorWithHexString:@"0xEF355D"]

#define kBackGroundColor_blue [UIColor colorWithHexString:@"0x26283A"]

#define kBackGroundColor_white [UIColor colorWithHexString:@"0xFFFFFF"]

#define kDetailTopBackGroundColor_black  [UIColor colorWithHexString:@"0x141520"]

#define kDetailBottomBackGroundColor_black [UIColor colorWithHexString:@"0x191c30"]


#define isIOS8_or_Later ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define isIOS9_or_Later ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0)
#define isIOS10_or_Later ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0)
#define isIOS7_or_Later ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)

#define kDevice_Is_iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

//DEBUG  模式下打印日志,当前行
#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define DLog(...)
#endif

#define KUserDefaults  [NSUserDefaults standardUserDefaults]

#define KNotificationCenter [NSNotificationCenter defaultCenter]

#define kHead  UICollectionElementKindSectionHeader
#define kFoot  UICollectionElementKindSectionFooter

#define kTipAlert(_S_, ...)     [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:(_S_), ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil] show]



#define BASEURL                   @"http://api.halobear.cn/"
#define ACTION(act)                       [NSString stringWithFormat:@"%@",act]

#endif /* KeyHeader_h */
